In some cases you may want to change a field's appearance depending on the data it represents. For example, you may want to highlight items that are expensive, or low in stock. This can be done with script.
To do this, complete the following steps:
' VBScript: Detail.OnFormat
If UnitsInStock + UnitsOnOrder < ReorderLevel And _
Discontinued = False Then
Detail.BackColor = rgb(255,190,190)
Else
Detail.BackColor = vbWhite
Endif
The script changes the Detail section's C1.C1Report.Section.BackColor property depending on the value of the fields UnitsInStock, UnitsOnOrder, ReorderLevel, and Discontinued.
Sample Report Available:
For the complete report, see report "16: Conditional Formatting" in the CommonTasks.xml report definition file, which is available for download from the CommonTasks sample on the ComponentOne HelpCentral Sample page.